﻿Class CustomDataGridView
    Inherits DataGridView

    Public Sub New()
        Me.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
        Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
    End Sub

    Private Sub CustomDataGridView_ColumnAdded(sender As Object, e As System.Windows.Forms.DataGridViewColumnEventArgs) Handles Me.ColumnAdded
        If e.Column.Index = 0 Or e.Column.Index = 2 Or e.Column.Index = 5 Then e.Column.Visible = False
    End Sub

    Private Sub CustomDataGridView_DataError(sender As Object, e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles Me.DataError

    End Sub

End Class